<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {:widget_st('layui','css')}
  {:widget_st('admin','css')}
  {:widget_st('jq','js')}
  {:widget_st('laydate','js')}    
  {:widget_st('webuploader')}
  {:widget_st('tinymce515')}
  {:widget_st('layui','js')}  
  {:widget_st('meditor')}

</head>
{:do_action('admin_head')}
<body> 
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">

      <form class="info_tj" method="post"  >
        <input type="hidden" name="cid" value="{$cid}">
        <input type="hidden" name="id" value="{$data_res['id']|default=''}">
        <div class="layui-col-sm12">
          <div class="layui-row layui-col-space15">
              <div class="layui-col-sm12">
                <div class="layui-card">
                <?php if($act=='add'){ ?>
                  {$form_widget->form_input('标题','title','')|raw}
                  {$form_widget->form_textarea('描述','summary','')|raw}
                  {$form_widget->form_textarea('Tag','tags','')|raw}
                  {$form_widget->upload_album('图集','album','')|raw}
                  {$form_widget->form_input('作者','author','')|raw}
                  {$form_widget->form_time('时间','ctime',date("Y-m-d H:i:s",time()) )|raw}
                  {$form_widget->form_input('排序','sort','')|raw}
                  {$form_widget->form_textarea('扩展参数','append','')|raw}
                  {$form_widget->upload_pic('封面图','pic','')|raw}
                  {$form_widget->upload_file('文件','file','')|raw}
                  {$form_widget->form_textarea('内容T(用于页面seo)','seo_t','')|raw}
                  {$form_widget->form_textarea('内容D(用于页面seo)','seo_d','')|raw}
                  {$form_widget->form_textarea('内容K(用于页面seo)','seo_k','')|raw}
                  {$form_widget->form_textarea('核心关键词','main_keys_m','')|raw}
                  {$form_widget->form_textarea('次要关键词','main_keys_c','')|raw}
                  {$form_widget->form_radio('状态','status','')|raw}
                  
                  <?php if($parm_data['editor_def']=='tinymce'){ ?>
                    {$form_widget->form_tinymce('内容详情','content','')|raw}
                  <?php }elseif($parm_data['editor_def']=='wangeditor'){ ?>
                    {$form_widget->form_wangeditor('内容详情','content','')|raw}   
                  <?php }elseif($parm_data['editor_def']=='meditor'){ ?>
                    {$form_widget->form_meditor('内容详情','content','')|raw}     
                  <?php }elseif($parm_data['editor_def']=='vditor'){ ?>
                    {$form_widget->form_vditor('内容详情','content','')|raw}                    
                  <?php }else{ ?>
                    {$form_widget->form_ueditor('内容详情','content','')|raw}                    
                    <?php } ?>

                  <!-- form_wangeditor -->
                  <!-- form_tinymce -->
                <?php }else{ ?>
                  {$form_widget->form_input('标题','title',$data_res['title'])|raw}
                  {$form_widget->form_textarea('描述','summary',$data_res['summary'])|raw}
                  {$form_widget->form_textarea('Tag','tags',$data_res['tags'])|raw}
                  {$form_widget->upload_album('图集','album',$data_res['album'])|raw}
                  {$form_widget->form_input('作者','author',$data_res['author'])|raw}
                  {$form_widget->form_time('时间','ctime',date("Y-m-d H:i:s",$data_res['ctime']) )|raw}
                  {$form_widget->form_input('排序','sort',$data_res['sort'])|raw}
                  {$form_widget->form_textarea('扩展参数','append',$data_res['append'])|raw}
                  {$form_widget->upload_pic('封面图','pic',$data_res['pic'])|raw}
                  {$form_widget->upload_file('文件','file',$data_res['file'])|raw}
                  {$form_widget->form_textarea('内容T(用于页面seo)','seo_t',$data_res['seo_t'])|raw}
                  {$form_widget->form_textarea('内容D(用于页面seo)','seo_d',$data_res['seo_d'])|raw}
                  {$form_widget->form_textarea('内容K(用于页面seo)','seo_k',$data_res['seo_k'])|raw}
                  {$form_widget->form_textarea('核心关键词','main_keys_m',$data_res['main_keys_m'])|raw}
                  {$form_widget->form_textarea('次要关键词','main_keys_c',$data_res['main_keys_c'])|raw}
                  {$form_widget->form_radio('状态','status',$data_res['status'])|raw}

                  <?php if($parm_data['editor_def']=='tinymce'){ ?>
                    {$form_widget->form_tinymce('内容详情','content',$data_res['content'])|raw}
                  <?php }elseif($parm_data['editor_def']=='wangeditor'){ ?>
                    {$form_widget->form_wangeditor('内容详情','content',$data_res['content'])|raw}   
                  <?php }elseif($parm_data['editor_def']=='meditor'){ ?>
                    {$form_widget->form_meditor('内容详情','content',$data_res['content'])|raw}  
                  <?php }elseif($parm_data['editor_def']=='vditor'){ ?>
                    {$form_widget->form_vditor('内容详情','content',$data_res['content'])|raw}                   
                  <?php }else{ ?>
                    {$form_widget->form_ueditor('内容详情','content',$data_res['content'])|raw}                    
                    <?php } ?>

                 <?php } ?> 

                 

                </div>
                <div class="layui-card">
                  <div class="layui-card-header">发布</div>
                  <div class="layui-card-body layui-row layui-col-space10">
                    <div class="layui-form-item">
                      <div class="layui-input-block" style="margin-left: 50px;">
                        <input class="layui-btn tijiao "  lay-filter="component-form-element" type="button" value="发布" />
                      </div> 
                    </div>
                  </div>
                </div>
              </div>
              
          </div>
        </div>
      </form>
        
      </div>
    </div>
  </div>
  

  <script>
 layui.use(['form','upload','laydate'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,element = layui.element
    ,form = layui.form
    ,laydate = layui.laydate
    ,upload = layui.upload;


    
    <?php if($parm_data['editor_def']=='tinymce'){ ?>
        $(".tijiao").on("click",function(){
          var index = layer.load(2);
          var content = tinymce.editors[0].getContent() ;   //id从0开始
          var data = $(".info_tj input,.info_tj textarea,.info_tj select").serializeArray();     
          $.ajax({
              type:'post',
              url:"{:url('admin/category/post_add')}",
              // data:data,
              data:{data:data,content:content,editor_type:'tinymce'},
              dataType:'json',
              success:function(res){
                layer.close(index);
                if(res.result==1){
                  layer.msg(res.msg, {icon: 1});
                  setTimeout(function() {
                    window.parent.location.reload();
                  }, 2000);
                }else{
                  layer.msg(res.msg, {icon: 2});
                  
                }
                
              }
          })
        });
    <?php }else{ ?>
      $(".tijiao").on("click",function(){
        var index = layer.load(2);
        var data = $(".info_tj input,.info_tj textarea,.info_tj select").serialize();      
        $.ajax({
            type:'post',
            url:"{:url('admin/category/post_add')}",
            data:data,
            dataType:'json',
            success:function(res){
              layer.close(index);
              if(res.result==1){
                layer.msg(res.msg, {icon: 1});
                setTimeout(function() {
                  window.parent.location.reload();
                }, 2000);
              }else{
                layer.msg(res.msg, {icon: 2});
                
              }
              
            }
        })
      });
    
    <?php } ?>


  

  });

  function deleteFile(obj) {
   $(obj).parent().remove();
  }
</script>
</body>
</html>
{:do_action('admin_js')}